var Tel = require("./utils/getRandomTel.js");
var handleContact = require("./utils/handleContact.js");

// 向上滑
function swipeUp() {
  swipe(device.width / 2, (device.height / 4) * 3, device.width / 2 + 100, device.height / 4 - 100, 1500);
}

console.show();
log("打开通讯录");
launch("com.android.contacts");
sleep(2000);
log("清空通讯录所有联系人");
handleContact.cleanContact();
log("清空完毕");
sleep(2000);
log("开始添加联系人");
sleep(1000);
for (var i = 0; i < 20; i++) {
  var name = "a" + i;
  var phone = Tel.getRandomPhone();
  log(name, phone);
  handleContact.addContact(name, phone);
  sleep(200);
  if (i == 10) {
    swipeUp();
  } else if (i == 15) {
    swipeUp();
  } else if (i == 18) {
    swipeUp();
  }
}
log("添加完成");
